In "cargo install" directly from registry, don't require optional dependencies
authorJosh Triplett <josh@joshtriplett.org>
Thu, 2 Mar 2017 02:19:43 +0000 (18:19 -0800)
committerJosh Triplett <josh@joshtriplett.org>
Mon, 6 Mar 2017 19:52:35 +0000 (11:52 -0800)
commitdb71d878fb4909575338f9f433b613ba94257d8b
tree751937077abdde4521bec2a7bdb0a38e0b50c2ad
parentbdce1f5d8aae833cf70586477c78f97607a675a4
In "cargo install" directly from registry, don't require optional dependencies

When building with a directory registry that contains only the subset of
crates required to build an application crate, cargo fails if that
subset doesn't include optional dependencies pulled in for every
possible feature of the root crate, even when the install doesn't enable
those features.  This prevents Linux distributions from building with
a minimal set of dependencies (omitting, for instance, packages for
unstable/nightly features).

Introduce a new workspace flag "require_optional_deps", disabled for
install and enabled for everything else.  Skip the initial
Method::Everything resolve in this case, and modify
resolve_with_previous to support running a Method::Required resolve
without a previous resolution.

This also skips adding path overrides, as those won't make sense (and
won't work) for an install directly from a registry.

Introduce a set of tests for "cargo install" directly from a directory
registry.
src/cargo/core/workspace.rs
src/cargo/ops/cargo_install.rs
src/cargo/ops/cargo_package.rs
src/cargo/ops/resolve.rs
tests/directory.rs